package com.jiaodian.servera.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import service.ISystemInfo;

/**
 * 测试微服务
 * @Autowired 获取的是IOC容器中的对象
 * @DubboReference 获取的是Dubbo的服务容器中的对象
 */
@RequestMapping("/test")
@RestController
public class TestController {

    /**
     * loadbalance是负载均衡，默认是随机，这里设置为轮询
     */
    @DubboReference(loadbalance = "roundrobin")
    private ISystemInfo iSystemInfo;

    @GetMapping("/hello")
    public String hello(){
        return iSystemInfo.getSystemInfo();
    }
}
